package com.lwj.liwanjia.presenter;

import com.lwj.liwanjia.bean.UrlBean;
import com.lwj.liwanjia.impl.UrlView;
import com.lwj.liwanjia.model.UrlModel;

import java.io.File;
import java.util.List;

import rx.Subscriber;

/**
 * Created by Administrator on 2017/10/21.
 */

public class UrlPresenter {
    private UrlView urlView;
    private UrlModel urlModel;

    public UrlPresenter(UrlView urlView) {
        this.urlView = urlView;
        urlModel = new UrlModel();
    }

    public void urlIndent(List<File> files, String token) {
        if (urlView != null) {
            urlModel.urlIndent(files, token, new Subscriber<UrlBean>() {
                @Override
                public void onCompleted() {

                }

                @Override
                public void onError(Throwable e) {
                    urlView.showError((Exception) e);
                }

                @Override
                public void onNext(UrlBean urlBean) {
                    urlView.inputIamge(urlBean);
                }
            });
        }
    }
}
